﻿<UserControl x:Class="DeltaGroup.WheelOfJeopardy.UI.Controls.PowerMeter"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	mc:Ignorable="d"
	x:Name="ucPowerMeter"
	d:DesignWidth="40" d:DesignHeight="450"
    Width="40" Height="450">
    <UserControl.Resources>
        <Storyboard x:Key="powerMeterStoryboard">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(RangeBase.Value)" Storyboard.TargetName="powerBar" RepeatBehavior="Forever">
                <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="100"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
    </UserControl.Resources>


    <Canvas x:Name="LayoutRoot" Background="#FFB4C6E4">
        <Canvas></Canvas>
        <ProgressBar x:Name="powerBar" Height="40" Canvas.Left="-190" Canvas.Top="189" Width="420" RenderTransformOrigin="0.5,0.5">
            <ProgressBar.RenderTransform>
                <TransformGroup>
                    <ScaleTransform />
                    <SkewTransform />
                    <RotateTransform Angle="-90" />
                    <TranslateTransform />
                </TransformGroup>
            </ProgressBar.RenderTransform>
        </ProgressBar>
        <Button x:Name="startPowerButton" Content="Power" Height="30" Canvas.Left="0" Canvas.Top="420" Width="40" Click="startPowerButton_Click">
            <Button.Triggers>
                <EventTrigger RoutedEvent="Button.PreviewMouseDown">
                    <BeginStoryboard x:Name="powerMeterStoryboard_BeginStoryboard" Storyboard="{StaticResource powerMeterStoryboard}" />
                </EventTrigger>
                <EventTrigger RoutedEvent="Button.PreviewMouseUp">
                    <PauseStoryboard BeginStoryboardName="powerMeterStoryboard_BeginStoryboard" />
                </EventTrigger>
            </Button.Triggers>
        </Button>
    </Canvas>
</UserControl>
